using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace RiceShop.Models
{
    /// <summary>
    /// 订单评论实体
    /// </summary>
    [Table("Comment")]
    public class Comment
    {
        /// <summary>
        /// 评论ID
        /// </summary>
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        public long OrderId { get; set; }

        /// <summary>
        /// 订单编号（用于显示）
        /// </summary>
        [Required]
        [StringLength(50)]
        public string OrderNo { get; set; } = string.Empty;

        /// <summary>
        /// 用户ID
        /// </summary>
        public long UserId { get; set; }

        /// <summary>
        /// 商品ID
        /// </summary>
        public long GoodId { get; set; }

        /// <summary>
        /// 商品SPU ID
        /// </summary>
        public long SpuId { get; set; }

        /// <summary>
        /// 评分(1-5星)
        /// </summary>
        [Range(1, 5)]
        public int Rating { get; set; }

        /// <summary>
        /// 评论内容
        /// </summary>
        [Required]
        [StringLength(1000)]
        public string Content { get; set; } = string.Empty;

        /// <summary>
        /// 图片URL列表，以逗号分隔
        /// </summary>
        [StringLength(2000)]
        public string? Images { get; set; }

        /// <summary>
        /// 是否匿名评论
        /// </summary>
        public bool IsAnonymous { get; set; }

        /// <summary>
        /// 是否已删除
        /// </summary>
        public bool IsDeleted { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 关联的订单
        /// </summary>
        public virtual Order Order { get; set; } = null!;

        /// <summary>
        /// 关联的用户
        /// </summary>
        public virtual User User { get; set; } = null!;

        /// <summary>
        /// 关联的商品
        /// </summary>
        public virtual Good Good { get; set; } = null!;
    }
} 